Command help
#1

PHP код:
CMD:removeplayerv(playerid, params[])
{
    new 
targetid, string[256], playeridn[MAX_PLAYER_NAME], targetidn[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_NICERED,SEM_NIVEL);
    if(
sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playerid, playeridn, sizeof(playeridn));
    
GetPlayerName(targetid, targetidn, sizeof(targetidn));
    
format(string, sizeof(string),"%s removed you from the vehicle.", targetidn); // I want this message for the player
    
SendClientMessage(playerid, playeridn, "You removed %s from the vehicle.", playeridn); // and this message for the admin
    
SendClientMessage(targetid, COLOR_ADMINCMD, string);
    return 
1;
} 
PHP код:
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(370) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase
1 Error
. 
Reply
#2

pawn Код:
SendClientMessage(playerid, playeridn, "You removed %s from the vehicle.", playeridn);
You need to use format and then send the formatted string.
Reply
#3

pawn Код:
SendClientMessage(playerid, playeridn, "You removed %s from the vehicle.", playeridn); // and this message for the admin
Should be more like
pawn Код:
new targetid, string[256], string2[256], playeridn[MAX_PLAYER_NAME], targetidn[MAX_PLAYER_NAME];
pawn Код:
format(string2, sizeof(string2), "You removed %s from the vehicle.", playeridn); // and this message for the admin
SendClientMessage(playerid, string2);
Reply
#4

Then?

PHP код:
CMD:removeplayerv(playerid, params[])
{
    new 
targetid, string[256], string2[256], playeridn[MAX_PLAYER_NAME], targetidn[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_NICERED,SEM_NIVEL);
    if(
sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playerid, playeridn, sizeof(playeridn));
    
GetPlayerName(targetid, targetidn, sizeof(targetidn));
    
format(string, sizeof(string),"%s removed you from the vehicle.", targetidn);
    
format(string2, sizeof(string2), "You removed %s from the vehicle.", playeridn);
    
SendClientMessage(targetid, COLOR_ADMINCMD, string);
    
SendClientMessage(playerid, COLOR_ADMINCMD, string2);
    return 
1;
} 
Reply
#5

Quote:
Originally Posted by DaYviSoN
Посмотреть сообщение
Then?

PHP код:
CMD:removeplayerv(playerid, params[])
{
    new 
targetid, string[256], string2[256], playeridn[MAX_PLAYER_NAME], targetidn[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_NICERED,SEM_NIVEL);
    if(
sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, COLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playerid, playeridn, sizeof(playeridn));
    
GetPlayerName(targetid, targetidn, sizeof(targetidn));
    
format(string, sizeof(string),"%s removed you from the vehicle.", targetidn);
    
format(string2, sizeof(string2), "You removed %s from the vehicle.", playeridn);
    
SendClientMessage(targetid, COLOR_ADMINCMD, string);
    
SendClientMessage(playerid, COLOR_ADMINCMD, string2);
    return 
1;
} 
Yup. Should work like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)