One weird little error...
#1

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:

Код:
Tag mismatch
Plz help me fix this, thnk you!
Reply
#2

if(!Deathmatch[playerid] == 1)

to

if(Deathmatch[playerid] == 1)
Reply
#3

But i wanna make it so if the player is in a deathmatch, he cant teleport...

Are you sure this will work?
Reply
#4

Then use:

if(Deathmatch[playerid] != 1)
Reply
#5

Quote:
Originally Posted by Finn
Then use:

if(Deathmatch[playerid] != 1)
Wouldnt it be easier to use

if(Deathmatch[playerid] == 0)?
Reply
#6

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.
Reply
#7

So, which one is better to use?

Sorry Don, I understood a bit, but not much about your post :S
Reply
#8

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.
Reply
#9

Ok! Thnx for your help:

Don Corelli and Finn!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)