29.05.2014, 13:06
Quote:
Код:
CMD:setvip(playerid, params[]) { if(pInfo[playerid][pAdmin] >= 3) { new vipString[500]; new vipLevel, targetid; new pName[MAX_PLAYER_NAME]; new tName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); GetPlayerName(targetid, tName, sizeof(tName)); if(sscanf(params, "id", targetid, vipLevel)) { SendClientMessage(playerid, 0xFF0000FF, "Correct Usage: /setvip [playerid] [level]"); return 1; } else { if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF0000FF, "Invalid Player ID"); if(vipLevel < 1 || vipLevel > 3) return SendClientMessage(playerid, 0xFF0000FF, "Only 1-3 Level is allowed"); pInfo[targetid][pRDonator] = vipLevel; format(vipString, sizeof(vipString), "{FFFFFF}Administrator {%06x}%s(%d) {FFFFFF}have set {%06x}%s(%d){FFFFFF}'s VIP Level to %d/3", (GetPlayerColor(playerid) >>> 8), pName, playerid, (GetPlayerColor(targetid) >>> 8), tName, targetid, vipLevel); SendClientMessageToAll(0xFF0000FF, vipString); } } else return SendClientMessage(playerid, 0xFF0000FF, "You must be Level 3 to use this command"); return 1; } |

Quote:
as i have said,You are getting the name of the targetid before getting the string he wrote,and when you do that it always gets id 0's name,so it shows wrong name,and makes the id you wrote the thing you want it to make him,so command of pingplayer should be:
pawn Код:
|

EDIT :-
Quote:
What R0 said about getting the name of the targetid before sscanf is correct. You basically get the name of the player with ID 0.
Except that, the sscanf specifiers are wrong. You have 3 parameters and 2 specifiers, sscanf should've given a warning for that in the console. Change to: pawn Код:
|
