Command help
#1

PHP код:
CMD:removeplayerv(playeridparams[])
{
    new 
targetidstring[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(playeridCOLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playeridplayeridnsizeof(playeridn));
    
GetPlayerName(targetidtargetidnsizeof(targetidn));
    
format(stringsizeof(string),"%s removed you from the vehicle."targetidn); // I want this message for the player
    
SendClientMessage(playeridplayeridn"You removed %s from the vehicle."playeridn); // and this message for the admin
    
SendClientMessage(targetidCOLOR_ADMINCMDstring);
    return 
1;

PHP код:
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(370) : error 035argument type mismatch (argument 2)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB 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(playeridparams[])
{
    new 
targetidstring[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(playeridCOLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playeridplayeridnsizeof(playeridn));
    
GetPlayerName(targetidtargetidnsizeof(targetidn));
    
format(stringsizeof(string),"%s removed you from the vehicle."targetidn);
    
format(string2sizeof(string2), "You removed %s from the vehicle."playeridn);
    
SendClientMessage(targetidCOLOR_ADMINCMDstring);
    
SendClientMessage(playeridCOLOR_ADMINCMDstring2);
    return 
1;

Reply
#5

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

PHP код:
CMD:removeplayerv(playeridparams[])
{
    new 
targetidstring[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(playeridCOLOR_ADMINCMD,"*{C8C8C8} Comando:{FFFFFF} /removeplayerv [playerid/ParteDoNome]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O jogador nao estб conectado!");
    if(!
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playeridCOLOR_NICERED,"[ERRO:] O player nao estб em nenhum veiculo!");
    
RemovePlayerFromVehicle(targetid);
    
GetPlayerName(playeridplayeridnsizeof(playeridn));
    
GetPlayerName(targetidtargetidnsizeof(targetidn));
    
format(stringsizeof(string),"%s removed you from the vehicle."targetidn);
    
format(string2sizeof(string2), "You removed %s from the vehicle."playeridn);
    
SendClientMessage(targetidCOLOR_ADMINCMDstring);
    
SendClientMessage(playeridCOLOR_ADMINCMDstring2);
    return 
1;

Yup. Should work like that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)