General > Developers Corner
Vehicle restricting
ahref:
found out its returning:
--- Code: ---
Redownloading all lightmaps
Airboat
ahref<UNKNOWN> spawned vehicle models/airboat.mdl
Pod
ahref<UNKNOWN> spawned vehicle models/nova/airboat_seat.mdl
Vehicle
ahref<UNKNOWN> spawned vehicle models/buggy.mdl
Pod
ahref<UNKNOWN> spawned vehicle models/nova/jeep_seat.mdl
Pod
ahref<UNKNOWN> spawned vehicle models/nova/chair_office01.mdl
Pod
ahref<UNKNOWN> spawned vehicle models/nova/chair_office02.mdl
Pod
ahref<UNKNOWN> spawned vehicle models/props_phx/carseat2.mdl
--- End code ---
which is really odd. but ohwell makes the code easier.
so it is now:
--- Code: ---local function spawned_vehicle( ply, prop )
if ( SinglePlayer() ) then return true end
if ply:IsAdmin() or ply:IsSuperAdmin() then
return
end
if not prop:GetClass( ) == "Pod" then
ply:PrintMessage( HUD_PRINTTALK, "This is Garrys Mod BUILD A VEHICLE(seats and pods are still allowed)" )
return false
else
return
end
end
hook.Add( "PlayerSpawnedVehicle", "ahrefspawnedvehicle", spawned_vehicle )
--- End code ---
qhich doesnt work but ill keep poking
JamminR:
OOps.
Sorry. Hook PropSpawnedVehicle will not work.
From it's description - Bold'ed for clarity
"Called when a player has already spawned a vehicle. Use this to record the vehicle's propid. Useful for prop protection.
See http://wiki.garrysmod.com/wiki/?title=Gamemode.PlayerSpawnProp for better way.
ahref:
now im at this:
--- Code: ---local function spawned_vehicle( ply, prop, ent )
if ( SinglePlayer() ) then return true end
if ply:IsAdmin() or ply:IsSuperAdmin() then
return
end
if not ent:GetClass( ) == "prop_vehicle_prisoner_pod" then
ply:PrintMessage( HUD_PRINTTALK, "This is Garrys Mod BUILD A VEHICLE(seats and pods are still allowed)" )
return false
else
return
end
end
hook.Add( "PlayerSpawnProp", "ahrefspawnedvehicle", spawned_vehicle );
--- End code ---
which doesnt work. at this point is probably just me though :(
JamminR:
The Gmod wiki article for PlayerSpawnedProp mentions nothing of your 3rd variable "ent" passed to your function.
Did you find code or mention of it somewhere?
Does 'Ent' actually get passed to it?
ahref:
sigh. i had a tab open with a hook. that had the 3 inputs must've asumed it was spawnprop. right now to get those model names :D
Navigation
[0] Message Index
[*] Previous page
Go to full version