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(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




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




Re: Command help - Nathan_Taylor - 06.05.2014

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.