error :| - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error :| (
/showthread.php?tid=180507)
error :| -
eXtr1kE - 01.10.2010
error :
Код:
C:\SAMP0~1.3BR\GAMEMO~1\gf.pwn(10782) : error 017: undefined symbol "playername"
C:\SAMP0~1.3BR\GAMEMO~1\gf.pwn(10782) : error 017: undefined symbol "playername"
C:\SAMP0~1.3BR\GAMEMO~1\gf.pwn(10782) : error 029: invalid expression, assumed zero
C:\SAMP0~1.3BR\GAMEMO~1\gf.pwn(10782) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
script :
Код:
CMD:rentroom(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++) {
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1) {
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0) { SendClientMessage(playerid, COLOR_WHITE, " You already own a house, type /sellhouse if you want to rent this one."); return 1; }
if(GetPlayerMoney(playerid) > HouseInfo[h][hRent]) {
PlayerInfo[playerid][pPhousekey] = h;
GivePlayerMoney(playerid,-HouseInfo[h][hRent]);
HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, You can enter and exit here anytime.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section.");
SavePlayerData(playerid);
return 1;
}
else { SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that"); return 1; }
}
}
}
return 1;
}
Re: error :| -
Alex_Valde - 01.10.2010
You forgot make:
new playername;
This should work now...
pawn Код:
CMD:rentroom(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
new Float:oldposx, Float:oldposy, Float:oldposz;
new playername; // <----- just add this line :)
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++) {
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1) {
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0) { SendClientMessage(playerid, COLOR_WHITE, " You already own a house, type /sellhouse if you want to rent this one."); return 1; }
if(GetPlayerMoney(playerid) > HouseInfo[h][hRent]) {
PlayerInfo[playerid][pPhousekey] = h;
GivePlayerMoney(playerid,-HouseInfo[h][hRent]);
HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, You can enter and exit here anytime.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section.");
SavePlayerData(playerid);
return 1;
}
else { SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that"); return 1; }
}
}
}
return 1;
}
Re: error :| -
Jeffry - 01.10.2010
This:
pawn Код:
CMD:rentroom(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
new Float:oldposx, Float:oldposy, Float:oldposz;
new playername[MAX_PLAYER_NAME]; // <----- just add this line & The array! :)
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(HouseInfo); h++) {
if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1) {
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0) { SendClientMessage(playerid, COLOR_WHITE, " You already own a house, type /sellhouse if you want to rent this one."); return 1; }
if(GetPlayerMoney(playerid) > HouseInfo[h][hRent]) {
PlayerInfo[playerid][pPhousekey] = h;
GivePlayerMoney(playerid,-HouseInfo[h][hRent]);
HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
PlayerPlayMusic(playerid);
SetPlayerInterior(playerid,HouseInfo[h][hInt]);
SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);
GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
PlayerInfo[playerid][pLocal] = h;
SendClientMessage(playerid, COLOR_WHITE, "Congratulations, You can enter and exit here anytime.");
SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section.");
SavePlayerData(playerid);
return 1;
}
else { SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that"); return 1; }
}
}
}
return 1;
}
Re: error :| -
willsuckformoney - 01.10.2010
no... its
pawn Код:
new playername[MAX_PLAYER_NAME];
EDIT: Lawl Jeffry beat me

o
Re: error :| -
Alex_Valde - 01.10.2010
OMFG! I forgot
[MAX_PLAYERS_NAME].
:S :S Thanks Jeffry!