SA-MP Forums Archive
[HELP] Plz 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: [HELP] Plz help me (/showthread.php?tid=174105)



[HELP] Plz help me - zack3021 - 04.09.2010

When ever i complie my script

Код:
	if (strcmp("/gate1", cmdtext, true, 10) == 0)
	{
        new pskin = GetPlayerSkin(playerid);
		if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
  		MoveObject(gate1,2681.3083496094, 659.74249267578, 11.495002746582,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just opened the front gate");
		return 1;
	}
	else
 	if (strcmp("/gate2", cmdtext, true, 10) == 0)
 	{
		MoveObject(gate1,2680.9462890625, 651.83990478516, 11.495002746582,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just closed the front gate");
		{
		return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
		}
  		return 1;

 }
I get this error

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\Pawno 0.3b\filterscripts\Gates.pwn(314) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Can someone help me fix this.


Re: [HELP] Plz help me - SpaZ (Ed) - 04.09.2010

Which is line 314?
Oh, else if must be on the same line.
Try now.
pawn Код:
if (strcmp("/gate1", cmdtext, true, 10) == 0)
    {
        new pskin = GetPlayerSkin(playerid);
        if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
               {
        MoveObject(gate1,2681.3083496094, 659.74249267578, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just opened the front gate");
        return 1;
               }
               else
        {
        return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }
 
    }
    else if (strcmp("/gate2", cmdtext, true, 10) == 0)
    {
         new pskin = GetPlayerSkin(playerid);
        if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
               {
        MoveObject(gate1,2680.9462890625, 651.83990478516, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just closed the front gate");
                }
                else
        {
        return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }
        return 1;

 }



Re: [HELP] Plz help me - zack3021 - 04.09.2010

Your code works (with a few adjustments) But it doesn't send the message saying "You are not a police officer!"

Код:
	if (strcmp("/gate1", cmdtext, true, 10) == 0)
    {
        new pskin = GetPlayerSkin(playerid);
        if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
               {
        MoveObject(gate1,2681.3083496094, 659.74249267578, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just opened the front gate");
        return 1;
               }
               else
        {
        return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }

    }
    else if (strcmp("/gate2", cmdtext, true, 10) == 0)
    {
         new pskin = GetPlayerSkin(playerid);
		 if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
 	{
        MoveObject(gate1,2680.9462890625, 651.83990478516, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just closed the front gate");
                }
                else
        {
        return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }
		 return 1;

 }



Re: [HELP] Plz help me - zack3021 - 04.09.2010

NVM Guys i got it to work.


Re: [HELP] Plz help me - WillyP - 04.09.2010

pawn Код:
if (strcmp("/gate1", cmdtext, true, 10) == 0)
    {
        new pskin = GetPlayerSkin(playerid);
        if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
               {
        MoveObject(gate1,2681.3083496094, 659.74249267578, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just opened the front gate");
        return 1;
               }
               else
        {
        return SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }

    }
    else if (strcmp("/gate2", cmdtext, true, 10) == 0)
    {
         new pskin = GetPlayerSkin(playerid);
         if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
    {
        MoveObject(gate1,2680.9462890625, 651.83990478516, 11.495002746582,3.0);
        SendClientMessage(playerid,0xFFFF00FF,"You have just closed the front gate");
                }
                else
        {
        SendClientMessage(playerid, 0xFF0000AA, "You are not a police officer!");
        }
         return 1;

 }
This forum requires that you wait 120 seconds between posts. Please try again in 34 seconds.
fuc yew :d