CMD:slap(playerid, params[]) { new targetid, string[128], name[128]; if(sscanf(params, "s", string)) { if(IsPlayerAdmin(playerid)) { SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server!"); SetPlayerVelocity(targetid, 0.5, 0.0, 0.0); return format(string, sizeof(string), "%s has slapped %s",GetName(playerid), GetName(playerid), name); SendMessageToRAdmins(0xFF0000FF, string); } } else { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x708090FF, "You are not a admin!"); } return 1; }
GreenIsGo.pwn(280) : warning 225: unreachable code
SendMessageToRAdmins(0xFF0000FF, string);
format(string, sizeof(string), "%s has slapped %s",GetName(playerid), GetName(playerid), name);
format(string, sizeof(string), "%s has slapped %s",GetName(playerid), GetName(targetid));
format(string, sizeof(string), "%s has slapped %s",GetName(playerid), GetName(playerid), name);
format(string, sizeof string, "%s has slapped %s",GetName(playerid), GetName(targetid));
CMD:slap(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x708090FF, "You are not a admin!"); new targetid, string[128]; if(isnull(params)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server!"); SetPlayerVelocity(targetid, 0.5, 0.0, 0.0); format(string, sizeof(string), "%s has slapped %s", GetName(playerid), GetName(targetid)); SendMessageToRAdmins(0xFF0000FF, string); return 1; }
Код:
CMD:slap(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x708090FF, "You are not a admin!"); new targetid, string[128]; if(isnull(params)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server!"); SetPlayerVelocity(targetid, 0.5, 0.0, 0.0); format(string, sizeof(string), "%s has slapped %s", GetName(playerid), GetName(targetid)); SendMessageToRAdmins(0xFF0000FF, string); return 1; } |
if(isnull(params)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]");
if(sscanf(params,"r",targetid)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]");
CMD:slap(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x708090FF, "You are not a admin!"); new string[128]; if(isnull(params)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]"); if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server!"); SetPlayerVelocity(strval(params), 0.5, 0.0, 0.0); format(string, sizeof(string), "%s has slapped %s", GetName(playerid), GetName(strval(params))); SendMessageToRAdmins(0xFF0000FF, string); return 1; }
Trial and error is good for me, I recommend you also edit the scripts from the Internet, is useful in understanding the new features and solutions to some things.
|
//Edit:
Ohh god, my mistake. I would suggest, however, dispense with sscanf. Код:
CMD:slap(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x708090FF, "You are not a admin!"); new string[128]; if(isnull(params)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]"); if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to the server!"); SetPlayerVelocity(strval(params), 0.5, 0.0, 0.0); format(string, sizeof(string), "%s has slapped %s", GetName(playerid), GetName(strval(params))); SendMessageToRAdmins(0xFF0000FF, string); return 1; } |
pawn Код:
|
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid, 0x708090FF, "Syntax: /slap [playerid]");