Need help in scripting.
#1

C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 017: undefined symbol "PlayerName"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 001: expected token: ")", but found ";"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 036: empty statement
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : fatal error 107: too many error messages on one line

i was adding in multi parameter for /givemoney cmd, but after adding in, they gave me this error. there wasn't any error before i add multi parameter in. NEED HELP!
Reply
#2

the things that are on line 1539 : if(!udb_Exists(PlayerName(playerid));
Reply
#3

Add this stock to get player name that you are missing

pawn Код:
stock PlayerName(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(i,pname,MAX_PLAYER_NAME);
    return pname;
}
Reply
#4

stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}

i had this in my script but after i overwriting yours over what i had, it still give me the same error.

C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 017: undefined symbol "PlayerName"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 001: expected token: ")", but found ";"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 036: empty statement
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : fatal error 107: too many error messages on one line
Reply
#5

Quote:
Originally Posted by heepzter
Посмотреть сообщение
stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}

i had this in my script but after i overwriting yours over what i had, it still give me the same error.

C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 017: undefined symbol "PlayerName"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 001: expected token: ")", but found ";"
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : error 036: empty statement
C:\Users\LinJun\Desktop\GTA - San Andreas\LSCNR\gamemodes\1.1.1.pwn(1539) : fatal error 107: too many error messages on one line
Show as the script that you got errors
Reply
#6

can you show us a part of the code?; including the defines that it has
Reply
#7

this is from line 1539 on wards

if(!udb_Exists(PlayerName(playerid));
{
SendClientMessage(playerid, COLOR_ERROR, "This player name is taken. Please login.");
ShowLoginScreen(playerid);
}
else if(!udb_ExistsPlayerName(playerid));
{
SendClientMessage(playerid, COLOR_ERROR, "This player name is not registered. Please do so before you spawn.");
ShowRegisterScreen(playerid);
}
for(new i = 0; i < sizeof(Objects); i++) Player[playerid][view][i] = false; /////////xobj

return 1;

this is the multi parameter i added

new idx;
new cmd[256];

cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/givemoney", true) == 0) {
new tmp[256], tmp2[256];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);

if(!strlen(tmp)} {
SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givemoney [playerid] [amount]");
return 1;
}

if(!strlen(tmp)} {
SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givemoney [playerid] [amount]");
return 1;
}

new receiver, money;
receiver = strval(tmp);
money = strval(tmp2);

if(GetPlayerMoney(playerid) < money){
SendClientMessage(playerid, COLOR_YELLOW, "The amount you typed in is higher than the amount you have.");
return 1;
}

new string[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(receiver, playername, sizeof(playername2));

format(string, sizeof(string), "You received $%d from %s.", money, playername);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You gave $%d to %s.", money, playername2);
SendClientMessage(playerid, COLOR_YELLOW, string);

GivePlayerMoney(playerid, (0 - money));
GivePlayerMoney(receiver, money);

return 1;
Reply
#8

if you don't mind please re-phrase your code between "[ p a w n ] your-code [/pawn]" << make it [pawn]
Reply
#9

the line from 1539 onwards

pawn Код:
if(!udb_Exists(PlayerName(playerid));
    {
        SendClientMessage(playerid, COLOR_ERROR, "This player name is taken. Please login.");
        ShowLoginScreen(playerid);
    }
    else if(!udb_ExistsPlayerName(playerid));
    {
        SendClientMessage(playerid, COLOR_ERROR, "This player name is not registered. Please do so before you spawn.");
        ShowRegisterScreen(playerid);
    }
    for(new i = 0; i < sizeof(Objects); i++) Player[playerid][view][i] = false; /////////xobj

    return 1;

    }
the multi parameter that i added

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])

{
    new idx;
    new cmd[256];
   
    cmd = strtok(cmdtext, idx);
   
    if(strcmp(cmd, "/givemoney", true) == 0) {
    new tmp[256], tmp2[256];
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);
   
    if(!strlen(tmp)} {
        SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givemoney [playerid] [amount]");
        return 1;
    }
       
    if(!strlen(tmp)} {
        SendClientMessage(playerid, COLOR_YELLOW, "Usage: /givemoney [playerid] [amount]");
        return 1;
    }
   
    new receiver, money;
    receiver = strval(tmp);
    money = strval(tmp2);
   
    if(GetPlayerMoney(playerid) < money){
       SendClientMessage(playerid, COLOR_YELLOW, "The amount you typed in is higher than the amount you have.");
       return 1;
    }
   
    new string[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(receiver, playername, sizeof(playername2));
   
    format(string, sizeof(string), "You received $%d from %s.", money, playername);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "You gave $%d to %s.", money, playername2);
    SendClientMessage(playerid, COLOR_YELLOW, string);
   
    GivePlayerMoney(playerid, (0 - money));
    GivePlayerMoney(receiver, money);
   
    return 1;
Reply
#10

i need help with this!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)