CMD:service(playerid, params[])
{
new id, izbor[16], price, Float:PosX, Float:PosY, Float:PosZ, str[128];
if(sscanf(params, "us[16]", id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [ID] [Price]");
if(!strcmp(izbor, "heal", true))
{
if(sscanf(params, "{s[16]}i", izbor, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service heal [ID] [Price($50-$500)]");
if(!IsPlayerConnected(id)) return SCM(playerid, ERRORCOLOR, "[ERROR]: That player is not online.");
GetPlayerPos(id, Float:PosX, Float:PosY, Float:PosZ);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, PosX, PosY, PosZ)) return SCM(playerid, GREY, "You must be close to that player");
CenaLecenja[id] = price;
LecenjePonudio[id] = playerid;
}
return 1;
}
if(sscanf(params, "us[16]", id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [ID] [Price]");
ocmd:service(playerid, params[])
{
new id; service[16];
if(sccanf(params,"us",id,service))return SendClientMessage(playerid,0xFFFFFFFF,"[HELP]: /service [ID] [heal/repair/refill]");
{
if(strcmp(service, "heal", true, strlen(service)) == 0)
{
new price;
if(sccanf(params,"usi",id,service,price))return SendClientMessage(playerid,0xFFFFFFFF,"[HELP]: /service [ID] [heal] [Price]");
{
//DoYourStuff
}
}
}
return 1;
}
I can't answer your question right now since I'm on my phone...
But IGNORE GangstaSunny's ANSWER! It's completely wrong. From what I see GangstaSunny doesn't know much at all about pawn or sscanf. |
new id; service[16];
new id, service[16];
CMD:service(playerid, params[])
{
new id, izbor[16], price, Float:PosX, Float:PosY, Float:PosZ, str[128];
if(sscanf(params, "us[16]", id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [ID] [Price]");
Originally Posted by Corrected
sscanf(params, "s[16]ii",izbor, id, price))
|
if(sscanf(params, "{s[16]}i", izbor, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service heal [ID] [Price($50-$500)]");
CMD:service(playerid, params[])
{
new id, izbor[16], price, Float:PosX, Float:PosY, Float:PosZ, str[128];
if(sscanf(params, "s[16]ui", izbor, id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [Username/ID] [Price]");
if(!strcmp(izbor, "heal", true))
{
if(!IsPlayerConnected(id)) return SCM(playerid, ERRORCOLOR, "[ERROR]: That player is not online.");
GetPlayerPos(id, Float:PosX, Float:PosY, Float:PosZ);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, PosX, PosY, PosZ)) return SCM(playerid, GREY, "You must be close to that player");
CenaLecenja[id] = price;
LecenjePonudio[id] = playerid;
}
return 1;
}
if(sscanf(params, "us[16]", id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [ID] [Price]");
if(sscanf(params, "s[16]ui", izbor, id, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service [heal/repair/refill] [ID] [Price]");
if(sscanf(params, "{s[16]}i", izbor, price)) return SCM(playerid, UPUTABOJA, "[HELP]: /service heal [ID] [Price($50-$500)]");