Why wont this work??
#1

Could someone tell me whats the issue here? cause Im working on a project for someone and he gave me this gamemode to edit etc... When i do /osetrank , it sends me the error message of what i should input, so thats sign that its working. Now when i do the full command, /osetrank Amanda_Clarke Test it sends me a message say the command doesnt exist


PHP код:
COMMAND:osetrank(playeridparams[])
{
    if(
PlayerInfo[playerid][ranklvl] != 0) return SendClientError(playeridCANT_USE_CMD);
    if(
PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playeridCANT_USE_CMD);
    new 
iPlayerMAX_PLAYER_NAME ], iRank[64];
    if( 
sscanf params"ss"iPlayeriRank) || strlen(params) > MAX_PLAYER_NAME) return SCP(playerid"[Exact Name] [rankname]");
    if(
AccountExist(iPlayer) == false) return SendClientError(playerid"Account hasn't been found!");
    if(
GetPlayerFaction(playerid) != GetPlayerFaction(iPlayer)) return SendClientError(playerid"Not in the same faction!");
    if(
strfind(iRank"'"true) != -|| strfind(iRank"="true) != -|| strfind(iRank"|"true) != -|| strlen(iRank) >= 64)
    {
        return 
SendClientError(playerid"Invalid character(s) used (~,=,|)");
    }
    
myStrcpy(PlayerInfo[iPlayer][rankname], iRank);
    
format(iStrsizeof(iStr), "10[RANK] %s has offline set the rank of %s to %s"PlayerName(playerid), PlayerName(iPlayer), iRank);
    
iEcho(iStr);
    
format(iStrsizeof(iStr), "# [%s] %s has offline set the rank of %s to %s."GetPlayerFactionName(playerid), RPName(playerid), RPName(iPlayer), iRank);
    
SendClientMessageToTeam(PlayerInfo[iPlayer][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
    return 
1;

Reply
#2

Код:
myStrcpy(PlayerInfo[iPlayer][rankname], iRank);
That should be playerid instead of iPlayer string right ?
Reply
#3

You're completely using a string in the place of integral values (i.e.)PlayerInfo enumeration and GetPlayerFaction functions.
To set rank of an offline player (or who's not connected in your words), you have to edit the PLAYER FILE (.ini in case of INI file systems, or the database table in case of MySQL). A integer holder cannot hold a string.
Reply
#4

Quote:
Originally Posted by SyS
Посмотреть сообщение
Код:
myStrcpy(PlayerInfo[iPlayer][rankname], iRank);
That should be playerid instead of iPlayer string right ?
But wouldn't that edit the rank of the player thats using the command , instead of the player thats offline, cause im a bit sure it would
Reply
#5

Quote:
Originally Posted by 1fret
Посмотреть сообщение
But wouldn't that edit the rank of the player thats using the command , instead of the player thats offline, cause im a bit sure it would
Why are you trying to change a variable of a disconnected player in first place? That's not the point of the command. If you want to edit data from a disconnected player you should modify his user file data, not a server variable.
Reply
#6

if( sscanf ( params, "s["MAX_PLAYER_NAME"]s[64]", iPlayer, iRank)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)