SA-MP Forums Archive
Command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command help (/showthread.php?tid=511601)



Command help - DaYviSoN - 06.05.2014

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
. 



Re: Command help - Konstantinos - 06.05.2014

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


Re: Command help - Nathan_Taylor - 06.05.2014

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);



Re: Command help - DaYviSoN - 06.05.2014

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;
} 



Re: Command help - Nathan_Taylor - 06.05.2014

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.