Command 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: Command error (
/showthread.php?tid=255240)
Command error -
buzifej - 14.05.2011
Hi!
The command is not good
Код:
dcmd_vinfo(playerid,params[]) {
new string[128],P1,player1;
if(!strlen(params)) player1 = playerid;
else player1 = strval(params);
if(IsPlayerConnected(player1)) {
if(PlayerInfo[player1][SpeedHax] == 1) P1 = "On"; else P1 = "Off";
format(string, sizeof(string), "%s-nek Stats: SpeedHack: %s",PlayerName2(player1), PlayerInfo[player1][SpeedHax]);
return SendClientMessage(playerid, green, string);
} else return SendClientMessage(playerid, red, "Error:Player is not connect"
}
Error:
error 006: must be assigned to an array
error 006: must be assigned to an array
error 017: undefined symbol "PlayerName2"
error 010: invalid function or declaration
PLEASE HELP!
Re: Command error -
StilThere - 14.05.2011
1. That is what is going wrong. You can't put a string in an integer. Do it like this:
pawn Код:
dcmd_vinfo(playerid,params[]) {
new string[128],P1[3],player1;
if(!strlen(params)) player1 = playerid;
else player1 = strval(params);
if(IsPlayerConnected(player1)) {
if(PlayerInfo[player1][SpeedHax] == 1) strpack(P1, "On", sizeof(P1)); else strpack(P1, "Off", sizeof(P1));
format(string, sizeof(string), "%s-nek Stats: SpeedHack: %s",PlayerName2(player1), PlayerInfo[player1][SpeedHax]);
return SendClientMessage(playerid, green, string);
} else return SendClientMessage(playerid, red, "Error:Player is not connect"
}
2. Define Playername2 and put a value in it before using it, I reckon it it is also a string so do it like this.
pawn Код:
new Playername2[MAX_PLAYER_NAME];
// and you can for example put a value in it with GetPlayerName(idofplayer, Playername2, sizeof(Playername2));
3. Close your functions
pawn Код:
else return SendClientMessage(playerid, red, "Error:Player is not connect");
Note you forgot the
);
4. Take a good look at your script yourself and think (hard) about the errors given. Try to find a solution next time before posting.
Good luck, let me know if that helped you.