Command error
#1

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

pawn Код:
P1 = "On"
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)