Whats wrong with this Command
#1

Код:
public OnPlayerSpawn(playerid)
{
	if (GetPlayerSkin(playerid) == 280 || 281 || 282 || 283 || 284 || 285)
	    {
	    GivePlayerWeapon(playerid,23,40);
	    SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
	    SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
	    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
	    SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
	    }
    if (GetPlayerSkin(playerid) == 287)
        {
		SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
		SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
		SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
		SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
		}
	return 1;
}
For every skin it shows the sendclientmessage .. !!
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    if (GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid == 281 || GetPlayerSkin(playerid == 282 || GetPlayerSkin(playerid == 283 || GetPlayerSkin(playerid == 284 || GetPlayerSkin(playerid == 285)
        {
        GivePlayerWeapon(playerid,23,40);
       SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        }
    else if (GetPlayerSkin(playerid) == 287)
        {
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
        SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        }
    return 1;
}
Reply
#3

pawn Код:
if (GetPlayerSkin(playerid) == 280 || 281 || 282 || 283 || 284 || 285)
There you are asking if 281 ... 285 are true. Which they are (none zero).

This is how you need to do it.

pawn Код:
new iSkinID = GetPlayerSkin(playerid);

if ( iSkinID == 280 || iSkinID == 281 || iSkinID == 282 iSkinID == || iSkinID == 283 || iSkinID == 284 || iSkinID == 285)
But even better.

pawn Код:
new iSkinID = GetPlayerSkin( playerid );
switch( iSkinID )
{

    case 280 .. 285:
    {
   
        GivePlayerWeapon(playerid,23,40);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
   
    }
   
    case 287:
    {
   
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
        SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
   
    }

}
Reply
#4

Quote:
Originally Posted by iggy1
Посмотреть сообщение
pawn Код:
if (GetPlayerSkin(playerid) == 280 || 281 || 282 || 283 || 284 || 285)
There you are asking if 281 ... 285 are true. Which they are (none zero).

This is how you need to do it.

pawn Код:
new iSkinID = GetPlayerSkin(playerid);

if ( iSkinID == 280 || iSkinID == 281 || iSkinID == 282 iSkinID == || iSkinID == 283 || iSkinID == 284 || iSkinID == 285)
But even better.

pawn Код:
new iSkinID = GetPlayerSkin( playerid );
switch( iSkinID )
{

    case 280 .. 285:
    {
   
        GivePlayerWeapon(playerid,23,40);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
   
    }
   
    case 287:
    {
   
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
        SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
   
    }

}
Sorry I am newbie scripter I don't understand what you telling ...
Reply
#5

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    if (GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid == 281 || GetPlayerSkin(playerid == 282 || GetPlayerSkin(playerid == 283 || GetPlayerSkin(playerid == 284 || GetPlayerSkin(playerid == 285)
        {
        GivePlayerWeapon(playerid,23,40);
       SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
        }
    else if (GetPlayerSkin(playerid) == 287)
        {
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
        SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
        SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
        }
    return 1;
}
Getting this error :
Код:
F:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP03~1\GAMEMO~1\mycnr.pwn(124) : error 001: expected token: ",", but found "{"
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
    new iSkinID = GetPlayerSkin( playerid );
    switch( iSkinID )
    {

        case 280 .. 285://the .. can be tought of as 'to'. So case 280 to 285
        {

            GivePlayerWeapon(playerid,23,40);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are a Cop");
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"Your job is to arrest criminals");
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"*___*____*___*___*____*____*___*___*___");

        }

        case 287:
        {

            SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");
            SendClientMessage(playerid,COLOR_VIOLET,"You are an Army Member");
            SendClientMessage(playerid,COLOR_VIOLET,"Your job is to arrest/kill red criminals");
            SendClientMessage(playerid,COLOR_VIOLET,"*___*____*___*___*____*____*___*___*___");

        }

    }
    return 1;
}
Even after a player dies and spawns this message will be shown.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)