Stock Help
#1

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
Reply
#2

643rd line?
Reply
#3

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;
}
Reply
#4

I suggest you to learn more about variables and player variables.
Reply
#5

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();
Reply
#6

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.
Reply
#7

Can u shpw ur real code with the real variables?
Reply
#8

Instead of pName it was pInfo, which I could've switched to playerdata, which would've had the same error.
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)