Help, Failing beginner....
#1

Quote:

if(strcmp("/makecaptain", cmdtext, true, 12) == 0)
{
new targetid;
if(!IsPlayerConnected(targetid))
{
SendClientMessage(playerid, COLOR_WRONG, "Player Not Connected!");
}
else
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_WRONG, "You are not an admin!");
}
else if(GetPlayerSkin[playerid] = 255))
{
new string[256];
new sendername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sendername2);
format(string, sizeof(string),"%s has made you a Captain, Don't abuse this position!", sendername2);
SetPlayerTeam(targetid, 0);
}
}
}
return 1;
}



With the errors :



Quote:

C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(397) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : error 028: invalid subscript (not an array or too many subscripts): "GetPlayerSkin"
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(410) : fatal error 107: too many error messages on one line


Line 410 =

else if(GetPlayerSkin[playerid] = 255))
Line 397 = if(strcmp("/makecaptain", cmdtext, true, 12) == 0)


Without the GetplayerSkin these errors come :

Quote:

C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(390) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(397) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(414) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\Administrator\Bureaublad\Samp server\gamemodes\Carrier.pwn(420) : warning 217: loose indentation

Line 390 = GetPlayerName(playerid, string, sendername); <<< This one is of another command ''/Selfdestruction'' ( only person that can do this is the Captain)
Line 397 =if(strcmp("/makecaptain", cmdtext, true, 12) == 0)
Line 414 = GetPlayerName(playerid, string, sendername2);
Line 420 = return 1;

Please Help, I cant continue scripting, Or give me a other example i have already tryed ''GetPlayerTeam'' but that crashes and getplayerskin diden't work too. (they can't change skin in my server)
Reply
#2

help ?
Reply
#3

You should look at how GetPlayerSkin works .... you don't need the [playerid] array because it's already a parameter of the GetPlayerSkin function, see here: https://sampwiki.blast.hk/wiki/GetPlayerSkin
Reply
#4

Can you make a example of how i must make the command?
Reply
#5

pawn Код:
if(strcmp("/makecaptain", cmdtext, true) == 0)
{
    new targetid;
    if(IsPlayerConnected(targetid))
    {
        if(IsPlayerAdmin(playerid))
        {
            new pSkin;
            pSkin = GetPlayerSkin(playerid);
           
            if(pSkin == 255))
            {
                new string[128]; // Make sure your strings are ALWAYS no higher than 128 cells
                new sendername2[MAX_PLAYER_NAME];
                GetPlayerName(playerid, string, sendername2);
                format(string, sizeof(string),"%s has made you a Captain, Don't abuse this position!", sendername2);
                SetPlayerTeam(targetid, 0);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WRONG, "You are not an admin!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WRONG, "Player Not Connected!");
    }
    return 1;
}
See if that works, also, if you're wanting to create any decent piece of code, you should consider using proper indentation
Reply
#6

Thank you mate!
Reply
#7

No problemo PM me if you need more help.
Reply
#8

Still, 4 error's can you give me your MSN So we can talk?
Reply
#9

Sure, I'll PM you.
Reply
#10

Okaay.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)