14.09.2010, 07:11
existe algun comando para dar score que solo funcione para admin
un ejemplo asi /darscore id cantidad
un ejemplo asi /darscore id cantidad
if(strcmp(cmd, "/darscore", true) == 0){
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, color, "ERROR: Comando solo para admins");
new tmp[256], tmp2[256];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, color, "USO: /darscore <jugador> <score>");
if(!IsNumeric(tmp))return SendClientMessage(playerid, color, "ERROR: el jugador debe ser una id valida");
if(!strlen(tmp))return SendClientMessage(playerid, color, "ERROR: Debes dar un score");
if(!IsNumeric(tmp2))return SendClientMessage(playerid, color, "ERROR: el score debe ser un numero");
new str[128], id, score, name[MAX_PLAYER_NAME];
id = strval(tmp);
SetPlayerScore(id, score);
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "Server: El admin %s(%i) ha incrementado tu score en %i", name, playerid, score);
SendClientMessage(id, color, str);
GetPlayerName(id, name, sizeof(name));
format(str, sizeof(str), "Server: Has incrementado el score de %s(%i) en %i", name, id, score);
return SendClientMessage(playerid, color, str);
}
me salen estos errores C:\Users\Roberto\samp\Destruccion total\gamemodes\lvdm.pwn(554) : error 017: undefined symbol "IsNumeric"
C:\Users\Roberto\samp\Destruccion total\gamemodes\lvdm.pwn(556) : error 017: undefined symbol "IsNumeric" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors. |
// Aсade la funciуn bajo tu Gm, sin estar en ningъn callback.
stock IsNumeric(const string[])
{
new length=strlen(string);
if(length == 0) return 0;
for(new i = 0; i < length; i++)
{
if ((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') || (string[i]=='-' && i!=0) || (string[i]=='+' && i!=0)) return 0;
}
if(length==1 && (string[0]=='-' || string[0]=='+')) return 0;
return 1;
}