CMD:changegravity(playerid,params[]){
new gravity = SetGravity(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,"d",gravity)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /changegravity [gravity]");
else
{
format(string,sizeof(string),"Admin %s has set the gravity to %d",GetName(playerid),gravity);
SendClientMessageToAll(COLOR_YELLOW,string);
}
return 1;
}
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))' |
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;
}
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);
SetGravity(gravity);
}
return 1;
}
SetGravity();