PDA

View Full Version : Need help in scripting.


heepzter
26/08/2012, 11:37 AM
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!

heepzter
26/08/2012, 11:40 AM
the things that are on line 1539 : if(!udb_Exists(PlayerName(playerid));

doreto
26/08/2012, 11:43 AM
Add this stock to get player name that you are missing

stock PlayerName(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(i,pname,MAX_PLAYER_NAME);
return pname;
}

heepzter
26/08/2012, 11:49 AM
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

doreto
26/08/2012, 11:52 AM
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

Youice
26/08/2012, 11:52 AM
can you show us a part of the code?; including the defines that it has

heepzter
26/08/2012, 11:55 AM
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;

Youice
26/08/2012, 11:59 AM
if you don't mind please re-phrase your code between "[ p a w n ] your-code [/pawn]" << make it [pawn]

heepzter
26/08/2012, 12:04 PM
the line from 1539 onwards

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



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;

heepzter
26/08/2012, 01:01 PM
i need help with this!!