Help with changegravity cmd.
#4

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Thats because '0.008' is a float, and not an integer.
Change the 'else if(sscanf(params,"d",gravity))' to 'else if(sscanf(params,"f",gravity))'
Also change "new gravity" into "new Float:gravity", and I don't think you need to add that "= SetGravity(gravity)" after it. Also change the second %d into %f, turning the whole thing into something like the following:

pawn Код:
CMD:changegravity(playerid,params[]){
    new Float:gravity, string[128];
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid,COLOR_GRAY,"Error: You're not on admin duty!");
    else if(PlayerInfo[playerid][pAdmin] < 4) return AdminRefuse(playerid);
    else if(sscanf(params,"f",gravity)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /changegravity [gravity]");
    else
    {
        format(string,sizeof(string),"Admin %s has set the gravity to %f",GetName(playerid),gravity);
        SendClientMessageToAll(COLOR_YELLOW,string);
    }
    return 1;
}
Reply


Messages In This Thread
Help with changegravity cmd. - by Azzeto - 18.10.2011, 18:25
Re: Help with changegravity cmd. - by Wesley221 - 18.10.2011, 18:55
Re: Help with changegravity cmd. - by Azzeto - 18.10.2011, 19:02
Re: Help with changegravity cmd. - by Gustavob - 18.10.2011, 19:02
Re: Help with changegravity cmd. - by Azzeto - 18.10.2011, 19:05
Re: Help with changegravity cmd. - by Azzeto - 18.10.2011, 19:08
Re: Help with changegravity cmd. - by Gustavob - 18.10.2011, 19:09
Re: Help with changegravity cmd. - by Drebin - 18.10.2011, 19:10
Re: Help with changegravity cmd. - by Azzeto - 18.10.2011, 19:16

Forum Jump:


Users browsing this thread: 2 Guest(s)