sscanf prob
#1

-.- just finished setscore from scratch that i made, if you want to have it take it
but help me im getting this problem
Код:
dcmd_setscore(playerid,params[])
{
	new string[128],score,id, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
 	if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid, red, "ERROR: You must be level 3");
	if(sscanf(params,"ui[128]",id,score)) return SendClientMessage(playerid, ORANGE, "USAGE:/setscore[playerid][score]");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid player id");
	
	GetPlayerName(playerid, pName, sizeof(pName));
	GetPlayerName(id, pName2, sizeof(pName2));
	format(string, sizeof(string), "%s has changed your score to %i", pName, score);
	SendClientMessage(id, ORANGE, string);
	format(string, sizeof(string), "You have changed '%s' score to %i",pName2, score);
	SendClientMessage(playerid, ORANGE, string);
	SetPlayerScore(id, score);
	return 1;
}
no errors no warnings, but yes warnings on the console -.-

why?
Reply
#2

Код:
dcmd_setscore(playerid,params[])
{
	new string[128],score,id, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
 	if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid, red, "ERROR: You must be level 3");
	if(sscanf(params,"ui",id,score)) return SendClientMessage(playerid, ORANGE, "USAGE:/setscore[playerid][score]");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid player id");
	
	GetPlayerName(playerid, pName, sizeof(pName));
	GetPlayerName(id, pName2, sizeof(pName2));
	format(string, sizeof(string), "%s has changed your score to %i", pName, score);
	SendClientMessage(id, ORANGE, string);
	format(string, sizeof(string), "You have changed '%s' score to %i",pName2, score);
	SendClientMessage(playerid, ORANGE, string);
	SetPlayerScore(id, score);
	return 1;
}
i[128] why?
Reply
#3

This should work:
pawn Код:
dcmd_setscore(playerid, params[])
{
    new string[128], pID, Score;
    if(sscanf(params, "ui", pID, Score) return SendClientMessage(playerid, Somecolor, "Usage: /setscore playerid / name - Score");
    SetPlayerScore(pID, Score);
    format(string, sizeof(string), "Admin: %s Changed your score to: %d",GetName(playerid),Score);
    SendClientMessage(pID, Somecolor, string);
    format(string, sizeof(string), "You changed : %s's Score to: %d",GetName(pID),Score);
    SendClientMessage(playerid, Somecolor, string);
    return 1;
}

stock GetPlayerNameEx(playerid)
{
    new pName[MAX_PLAYERS_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)