how to ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to ? (
/showthread.php?tid=81876)
how to ? -
coole210 - 14.06.2009
Okay i got gTeams n stuff.
But with my script if the player is in TEAM_HITMAN and he enters his car it says its for hitmen only and removes player from vehicle.
I have two questions.
How do i stop it from saying its for hitman only IF the player is a hitman?
Script : (Onplayerstatechange)
WHAT I HAVE TRIED :
Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 409:
{
if(TEAM_MAYOR == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Welcome to you're vehicle.");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This is for Mayors only!");
}
}
}
}
NORMAL SCRIPT I FOUND:
Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 405:
{
if(gTeam[playerid] == TEAM_HITMAN)
{
// GameTextForPlayer(playerid, "~g~You have entered a faction vehicle.", 3000, 3);
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This is for Hitmen only!");
}
}
}
}
SECOND QUESTION
How do i make it so it sends a message and doesnt let the player in the vehicle BEFORE he enters it?
Because some people enter the SWAT truck and gain the armour. Which i dont want.
Re: how to ? -
Grim_ - 14.06.2009
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(GetPlayerVehicleID == /*modelid of vehicle here*/)
{
if(gTeam[playerid] != TEAM_HITMAN)
{
GameTextForPlayer(playerid, "~r~ You are not a hitman! ~n~ ~w~ You cannot drive this car!", 5000, 5);
RemovePlayerFromVehicle(playerid);
}
}
}
Re: how to ? -
jonesy - 14.06.2009
Quote:
doesnt let the player in the vehicle BEFORE he enters it
|
you could just lock the cars using
SetVehicleParamsForPlayer
and then unlock them when the player spawns as that team
(the code below is just an example to demonstrate what i mean)
pawn Код:
lockhitmancars(playerid){
SetVehicleParamsForPlayer(Hitmancar[0],playerid,0,1);
SetVehicleParamsForPlayer(Hitmancar[1],playerid,0,1);
//etc
};
unlockhitmancars(playerid){
SetVehicleParamsForPlayer(Hitmancar[0],playerid,0,0);
SetVehicleParamsForPlayer(Hitmancar[1],playerid,0,0);
//etc
};
//onplayerconnect
lockhitmancars(playerid);
//onplayerspawn
if(gTeam[playerid] == TEAM_HITMAN) unlockhitmancars(playerid);
Re: how to ? -
coole210 - 14.06.2009
Quote:
Originally Posted by jonesy
Quote:
doesnt let the player in the vehicle BEFORE he enters it
|
you could just lock the cars using SetVehicleParamsForPlayer
and then unlock them when the player spawns as that team
(the code below is just an example to demonstrate what i mean)
pawn Код:
lockhitmancars(playerid){ SetVehicleParamsForPlayer(Hitmancar[0],playerid,0,1); SetVehicleParamsForPlayer(Hitmancar[1],playerid,0,1); //etc };
unlockhitmancars(playerid){ SetVehicleParamsForPlayer(Hitmancar[0],playerid,0,0); SetVehicleParamsForPlayer(Hitmancar[1],playerid,0,0); //etc };
//onplayerconnect lockhitmancars(playerid);
//onplayerspawn if(gTeam[playerid] == TEAM_HITMAN) unlockhitmancars(playerid);
|
ty no warning/errors. Imma test it
Re: how to ? -
coole210 - 16.06.2009
Doesn't work. Couldn't test for a while cuz my Gm was screwed up a bit