Comando para dar score
#1

existe algun comando para dar score que solo funcione para admin
un ejemplo asi /darscore id cantidad
Reply
#2

fijate si esto te sirve

pawn Код:
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);
}
espero que te sirva, cualquier error avisame xq la scriptie sobre el cuadro de respuesta rapida y no la chekie
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by pegazo15
Посмотреть сообщение
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.
pawn Код:
// 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;
}
Estб hecho por DracoBlue.
Reply
#5

no me dio ningun error en el pawno pero cuando lo probe en el server te pone el score a 0 no te suma el score te lo quita todo a 0
Reply
#6

Cambia esta parte:

new str[128], id, score, name[MAX_PLAYER_NAME];
id = strval(tmp);
SetPlayerScore(id, score);


Y dejala asi:

new str[128], id, score, name[MAX_PLAYER_NAME];
id = strval(tmp);
score = strval(tmp2);
SetPlayerScore(id, score);
Reply
#7

Quote:
Originally Posted by JoseAanguelCle
Посмотреть сообщение
Cambia esta parte:

new str[128], id, score, name[MAX_PLAYER_NAME];
id = strval(tmp);
SetPlayerScore(id, score);


Y dejala asi:

new str[128], id, score, name[MAX_PLAYER_NAME];
id = strval(tmp);
score = strval(tmp2);
SetPlayerScore(id, score);
No revivas temas viejos, te diste cuenta que es un post de hace 6 aсos?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)