SA-MP Forums Archive
1 Error simple help me. - 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: 1 Error simple help me. (/showthread.php?tid=244778)



1 Error simple help me. - Davz*|*Criss - 28.03.2011

Hey scripters i am trying to make an mg1 cmd,

that if the player types once /mg1 and teleport him to that interior and player cant type /mg1 /mg1 again and again to abuse when player is in /mg1 and when player type again /mg1 it will say you're already in mg1.

Thnx

here is code:-

pawn Код:
CMD:mg1(playerid, params[])
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new string[128];
    new rand = random(sizeof(RandomSpawn));
    IsInMiniGame[playerid] = 1;
    format(string,sizeof(string), "%s has joined the Minigun 1. (/MG1)", pName);
    SendClientMessageToAll(0x33CCFFAA, string);
    SetPlayerVirtualWorld(playerid, 30);
    SetPlayerInterior(playerid, 17);
    GivePlayerWeapon(playerid, 38, 10000);
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
    else
    {
        if(IsInMiniGame[playerid] == 1)
        {
             format(string, sizeof(string), "Type ~r~/Exitmg1 to exit from ~g~the MG1!");
             GameTextForPlayer(playerid, string, 3000, 4);
        }
    }
    return 1;
}
and the error:-

pawn Код:
C:\Users\smith\Desktop\Server 2\gamemodes\rrrrrr.pwn(177) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
thnx


Re: 1 Error simple help me. - Sascha - 28.03.2011

which is the error line?
however I see you are using "else" without an "if" statement before...


Re: 1 Error simple help me. - Davz*|*Criss - 28.03.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
which is the error line?
however I see you are using "else" without an "if" statement before...
error line is 'else'


Re: 1 Error simple help me. - Sascha - 28.03.2011

yea... use the code of magazinez..
and for the future:
you cannot use an "else" statement if you didn't use an "if" statement before..
so:
pawn Код:
if (playerid == noob) //THEN DO SOMETHING
else //THEN DO SOMETHING ELSE..
but not..
pawn Код:
//DO SOMETHING
else //DO SOMETHING
the else does something in case the "if" statement is not true... but if there is no "if" statement, there is nothing the "else" can do..


Re: 1 Error simple help me. - Davz*|*Criss - 28.03.2011

thanks

What i want that u did.