SA-MP Forums Archive
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)
+--- Thread: Help me !! (/showthread.php?tid=325166)



Help me !! - Xaviour212 - 12.03.2012

I have a problem, i use a script like that :

pawn Код:
#define TEAM_Red 2

public OnPlayerConnect(playerid)
{
        SetPlayerClass(playerid, "Red");
        return 1;
}

stock GetPlayerClass(playerid)
{
     new asd[64];
     GetPVarString(playerid, "Class", asd, 64);
     return asd;
}

forward SetPlayerClass(playerid, class[]);
public SetPlayerClass(playerid, class[])
{
     new skin[32], asdf;
     SetPVarString(playerid, "Class", class);
     format(skin, 32, "TEAM_%s", class);
     asdf = "#skin";
}
When I compile, I got error :

Код:
error 006: must be assigned to an array
How do I fix this error ?
Thanks


Re: Help me !! - nmader - 12.03.2012

May I ask what line it is on?


Re: Help me !! - Pghpunkid - 12.03.2012

pawn Код:
forward SetPlayerClass(playerid, class[]);
public SetPlayerClass(playerid, class[])
{
     new skin[32], asdf;
     SetPVarString(playerid, "Class", class);
     format(skin, 32, "TEAM_%s", class);
     asdf = "#skin";
}
Your problem (from what i can see) is that you are trying to assign "#skin" into a variable that is not compatible with strings. Try defining asdf as asdf[5].

Without more information thats all i can suggest.


Re: Help me !! - Xaviour212 - 12.03.2012

Quote:
Originally Posted by Pghpunkid
Посмотреть сообщение
pawn Код:
forward SetPlayerClass(playerid, class[]);
public SetPlayerClass(playerid, class[])
{
     new skin[32], asdf;
     SetPVarString(playerid, "Class", class);
     format(skin, 32, "TEAM_%s", class);
     asdf = "#skin";
}
Your problem (from what i can see) is that you are trying to assign "#skin" into a variable that is not compatible with strings. Try defining asdf as asdf[5].

Without more information thats all i can suggest.
No... I will create the function become :
pawn Код:
forward SetPlayerClass(playerid, class[]);
public SetPlayerClass(playerid, class[])
{
     new skin[32], asdf;
     SetPVarString(playerid, "Class", class);
     format(skin, 32, "TEAM_%s", class);
     asdf = "#skin";
     SetPlayerSkin(playerid, asdf);
}
I mean when player spawned, the skin is become TEAM_(player class), so player skin will become skinid 2 if they are red team. But if I using asdf[5] Im get an error :

Код:
error 035: argument type mismatch (argument 2)
Quote:
Originally Posted by nmader
Посмотреть сообщение
May I ask what line it is on?
In a end of the line, at asdf = "#skin";

Sorry for my bad English