Stock Help - 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: Stock Help (
/showthread.php?tid=590848)
Stock Help -
MD5 - 04.10.2015
Here's the code:
Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
new pName[MAX_PLAYER_NAME];
if(classid >= 0 && classid <= 2) pName[playerid][gTeam] = TEAM_NANANG;
else if(classid >= 3 && classid <= 5) pName[playerid][gTeam] = TEAM_FIERRO;
else if(classid >= 6 && classid <= 8) pName[playerid][gTeam] = TEAM_TRIAD;
else if(classid >= 9 && classid <= 11) pName[playerid][gTeam] = TEAM_BIKER;
else if(classid >= 12 && classid <= 14) pName[playerid][gTeam] = TEAM_MAFIA;
else if(classid >= 14 && classid <= 17) pName[playerid][gTeam] = TEAM_ARMY;
}
Here's the errors:
Код:
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : warning 215: expression has no effect
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : error 001: expected token: ";", but found "["
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : warning 215: expression has no effect
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : error 001: expected token: ";", but found "]"
C:\Users\\Desktop\GAMEMODE\gamemodes\lsgw.pwn(653) : fatal error 107: too many error messages on one line
Re: Stock Help -
ATGOggy - 04.10.2015
643rd line?
Re: Stock Help -
Kevln - 04.10.2015
The use of the variable "pName" is totally wrong.
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
new pName[MAX_PLAYER_NAME];
if(classid >= 0 && classid <= 2) strcat(pName, TEAM_NANANG);
else if(classid >= 3 && classid <= 5) strcat(pName, TEAM_FIERRO);
else if(classid >= 6 && classid <= 8) strcat(pName, TEAM_TRIAD);
else if(classid >= 9 && classid <= 11) strcat(pName, TEAM_BIKER);
else if(classid >= 12 && classid <= 14) strcat(pName, TEAM_MAFIA);
else if(classid >= 14 && classid <= 17) strcat(pName, TEAM_ARMY);
return pName;
}
Re: Stock Help -
ATGOggy - 04.10.2015
I suggest you to learn more about variables and player variables.
Re: Stock Help -
d1git - 04.10.2015
Quote:
Originally Posted by Kevln
The use of the variable "pName" is totally wrong.
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid) { new pName[MAX_PLAYER_NAME];
if(classid >= 0 && classid <= 2) strcat(pName, TEAM_NANANG); else if(classid >= 3 && classid <= 5) strcat(pName, TEAM_FIERRO); else if(classid >= 6 && classid <= 8) strcat(pName, TEAM_TRIAD); else if(classid >= 9 && classid <= 11) strcat(pName, TEAM_BIKER); else if(classid >= 12 && classid <= 14) strcat(pName, TEAM_MAFIA); else if(classid >= 14 && classid <= 17) strcat(pName, TEAM_ARMY); return pName; }
|
I thought strcat(); wasn't used for replacing strings? I've always used myStrcpy();
Re: Stock Help -
MD5 - 04.10.2015
Quote:
Originally Posted by ATGOggy
I suggest you to learn more about variables and player variables.
|
OK, well.. pName was just a temp fix; but even without pName I still had the same error.
Re: Stock Help -
ATGOggy - 04.10.2015
Can u shpw ur real code with the real variables?
Re: Stock Help -
MD5 - 04.10.2015
Instead of pName it was pInfo, which I could've switched to playerdata, which would've had the same error.
Re: Stock Help -
AbyssMorgan - 04.10.2015
This code is to suck
new pName[MAX_PLAYER_NAME]; //for string, len 24
pName[playerid][gTeam] //and how it has to top ^^
variable in the function will not save her outside ~.~
Go learn to pawn.
Re: Stock Help -
MD5 - 04.10.2015
Quote:
Originally Posted by AbyssMorgan
This code is to suck
new pName[MAX_PLAYER_NAME]; //for string, len 24
pName[playerid][gTeam] //and how it has to top ^^
variable in the function will not save her outside ~.~
Go learn to pawn.
|
Go learn English you dumb fuck.