SA-MP Forums Archive
Help, Failing beginner.... - 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, Failing beginner.... (/showthread.php?tid=269917)



Help, Failing beginner.... - Brunok - 18.07.2011

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)


Re: Help, Failing beginner.... - Brunok - 18.07.2011

help ?


Re: Help, Failing beginner.... - Famalamalam - 18.07.2011

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


Re: Help, Failing beginner.... - Brunok - 18.07.2011

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


Re: Help, Failing beginner.... - Famalamalam - 18.07.2011

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


Re: Help, Failing beginner.... - Brunok - 18.07.2011

Thank you mate!


Re: Help, Failing beginner.... - Famalamalam - 18.07.2011

No problemo PM me if you need more help.


Re: Help, Failing beginner.... - Brunok - 18.07.2011

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


Re: Help, Failing beginner.... - Famalamalam - 18.07.2011

Sure, I'll PM you.


Re: Help, Failing beginner.... - Brunok - 18.07.2011

Okaay.