Little Explanation - 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)
+--- Thread: Little Explanation (
/showthread.php?tid=569620)
Little Explanation -
NoDi522 - 01.04.2015
I need explanation with something. So i have my @OnPlayerStateChange:
PHP Code:
{
new Vozilo = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Vozilo == Autobus[0] || Vozilo == Autobus[1] || Vozilo == Autobus[2] || Vozilo == Autobus[3] || Vozilo == Autobus[4])
{
if(PlayerPosao[playerid][pZaposlen] != 1) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste zaposleni kao vozac autobusa"); // This line
else if(PlayerPosao[playerid][pID] != 1) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste zaposleni kao vozac autobusa") && RemovePlayerFromVehicle(playerid);
{
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Zapocnite posao:"COLOR_LAGANA" /ruta");
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Prekinite posao:"COLOR_LAGANA" /prekiniposao");
}
}
}
return 1;
}
Here you can see a line:
PHP Code:
if(PlayerPosao[playerid][pZaposlen] != 1) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste zaposleni kao vozac autobusa");
I need an explanation how could I make this: ...[pZaposlen] != "Potvrda" instead of != 1. I want do to that because when i get job it saves into the ini file "Employed: True" not "Employed: 1"... Any ideas?
Re: Little Explanation -
CalvinC - 01.04.2015
Use a boolean.
Re: Little Explanation -
NoDi522 - 01.04.2015
That i know how to use it to get no errors i wouldn't ask this question.
Re: Little Explanation -
BroZeus - 01.04.2015
If its a boolean then you can just do this
PHP Code:
if(PlayerPosao[playerid][pZaposlen])return ....
But it seems u make it load it as a string, so if its a string then you gotta do this :
PHP Code:
if(strcmp(PlayerPosao[playerid][pZaposlen], "Potvrda") != 0) return ...
strcmp returns 0 if string matches so we do != 0