One weird little error... -
Tigerbeast11 - 31.10.2009
Hi!
This is my script so far...
pawn Код:
if(strcmp(cmdtext, "/driftaa", true)==0)
{
if(!Deathmatch[playerid] == 1)//The error is on this line!
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new car;
car = GetPlayerVehicleID(playerid);
SetVehiclePos(car,149.5744, 2487.4087, 41.2186);
SendClientMessage(playerid, COLOR_ORANGE, "Server: Welcome to the Old Abandoned Airport Drifting Region!");
}
else
SetPlayerPos(playerid,149.5744, 2487.4087, 41.2186);
SendClientMessage(playerid, COLOR_ORANGE, "Server: Welcome to the Old Abandoned Airport Drifting Region!");
}
else
SendClientMessage(playerid, COLOR_ORANGE,"Server: You cannot teleport whilst inside a DM. Use /quitdm first");
return 1;
Yes, its a teleport! But I get the following error:
Plz help me fix this, thnk you!
Re: One weird little error... -
Finn - 31.10.2009
if(!Deathmatch[playerid] == 1)
to
if(Deathmatch[playerid] == 1)
Re: One weird little error... -
Tigerbeast11 - 31.10.2009
But i wanna make it so if the player is in a deathmatch, he cant teleport...
Are you sure this will work?
Re: One weird little error... -
Finn - 31.10.2009
Then use:
if(Deathmatch[playerid] != 1)
Re: One weird little error... -
Tigerbeast11 - 31.10.2009
Quote:
Originally Posted by Finn
Then use:
if(Deathmatch[playerid] != 1)
|
Wouldnt it be easier to use
if(Deathmatch[playerid] == 0)?
Re: One weird little error... -
Correlli - 31.10.2009
Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by Finn
Then use:
if(Deathmatch[playerid] != 1)
|
Wouldnt it be easier to use
if(Deathmatch[playerid] == 0)?
|
!= 1 will check if
Deathmatch variable ISN'T equal to 1 (
it will pass any number which isn't 1) and if it's isn't, then it will execute the other code in the if-statement but
== 0 will check if
Deathmatch variable IS equal to 0 (
it will pass only number 0) and will execute the other code in the if-statement.
Re: One weird little error... -
Tigerbeast11 - 31.10.2009
So, which one is better to use?
Sorry Don, I understood a bit, but not much about your post :S
Re: One weird little error... -
Correlli - 31.10.2009
Quote:
Originally Posted by Tigerbeast11
Sorry Don, I understood a bit, but not much about your post :S
|
This example will execute
myFunction() only if
myVariable ISN'T 1 - it means it will execute if
myVariable is -2147483647, .. -2, -1, 0, 2, 3, 4, .. 2147483647.
pawn Код:
if(myVariable != 1)
{
myFunction();
}
This example will execute
myFunction() only if
myVariable IS 0 - it means it will execute if
myVariable is 0.
pawn Код:
if(myVariable == 0)
{
myFunction();
}
Quote:
Originally Posted by Tigerbeast11
So, which one is better to use?
|
Depends on your situation.
Re: One weird little error... -
Tigerbeast11 - 31.10.2009
Ok! Thnx for your help:
Don Corelli and Finn!