Big problem with variables - 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: Big problem with variables (
/showthread.php?tid=180538)
Big problem with variables -
Scriptissue - 01.10.2010
I was trying to make variables that only a player who belongs to a Faction1 can use a certain car, I have no warnings nothing everything is defined, I even open a File on "users" to check everything, the problem is when I log in game and enter every car It "slaps" me spawns me where I started and doesn't say a thing, can anyone fix my script ?
This is the whole script, there are only few "new" at the top, nothing more.
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new tmp[256];
new idx;
new cmdtext[256];
new string[64];
tmp = strtok(cmdtext, idx);
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
if(vehicleid == na1)
if(dini_Exists(faction1)) {
GetPlayerPos(otherId, slx, sly, slz);
SetPlayerPos(otherId, slx, sly, slz+5);
format(string, sizeof(string), "Vehicle Faction !", playername1);
SendClientMessage(playerid, 0xFF4646F, string);
return 1;
}
if(strcmp(PlayerName(playerid),faction1, true) != 0)
if(!dini_Exists(faction1)) { dini_Create(faction1);
dini_Set(faction1,"pass",tmp);
logged[playerid] = 1; format(string, sizeof(string), " You are in a faction, congratulations", playername1, tmp);
SendClientMessage(playerid, 0xFF4646FF, string); }
SetPlayerPos(playerid,1270.0521,-1557.4521,13.5625);
return 1;
}
Re: Big problem with variables -
willsuckformoney - 01.10.2010
Supposed to get if the player enters the faction car, and also...
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
//NOT
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
EDIT: Like
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
if(IsPlayerInAnyVehicle(playerid) == FACTIONCAR)
{
if(IsPlayerInFaction(playerid)) return 1;
}
}
Something like that.
EDIT 2: Don't use PHP Code use
[ pawn ] [ /pawn ]
without the spaces.