SA-MP Forums Archive
I need some help with this command. - 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: I need some help with this command. (/showthread.php?tid=596718)



I need some help with this command. - GabiXx - 21.12.2015

I need a command who slap a car, command i want to be like this: /slapcar id-player.
So player who drive car will take slap with his car, and car will be slaped.


Re: I need some help with this command. - TwinkiDaBoss - 21.12.2015

Here you go

This will only slap their vehicle
PHP код:
CMD:slapcar(playerid,params[]) {
    new 
otherplayerothercar;
    if(
sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
    if(!
IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
    new 
Float:x,Float:y,Float:z;
    
othercar GetPlayerVehicleID(otherplayer);
    
GetVehiclePos(othercar,x,y,z);
    
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
    
    
new string[128];
    
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
    
SendClientMessage(playerid,COLOR_RED,string);
    return 
true;

This will slap the player & their vehicle
PHP код:
CMD:slapcar(playerid,params[]) {
    new 
otherplayerothercar;
    if(
sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
    if(!
IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
    new 
Float:x,Float:y,Float:z;
    
othercar GetPlayerVehicleID(otherplayer);
    
GetVehiclePos(othercar,x,y,z);
    
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
    
new string[128];
    
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
    
SendClientMessage(playerid,COLOR_RED,string);
    
    
    
GetPlayerPos(otherplayer,x,y,z);
    
SetPlayerPos(otherplayer,x,y,z+10);
    return 
true;




Re: I need some help with this command. - GabiXx - 21.12.2015

Thanks, but you can put restricted for players, and just admins to use it admin level 1+.


Re: I need some help with this command. - TwinkiDaBoss - 21.12.2015

Quote:
Originally Posted by GabiXx
Посмотреть сообщение
Thanks, but you can put restricted for players, and just admins to use it admin level 1+.
Pick your version
PHP код:
CMD:slapcar(playerid,params[]) {
    new 
otherplayerothercar;
    if(
playerVariables[playerid][pAdminLevel] == ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin"); //if they arent admin
    
if(sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
    if(!
IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
    new 
Float:x,Float:y,Float:z;
    
othercar GetPlayerVehicleID(otherplayer);
    
GetVehiclePos(othercar,x,y,z);
    
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
    
new string[128];
    
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
    
SendClientMessage(playerid,COLOR_RED,string);
    return 
true;
}
CMD:slapcar(playerid,params[]) {
    new 
otherplayerothercar;
    if(
playerVariables[playerid][pAdminLevel] == ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin"); //if they arent admin
    
if(sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
    if(!
IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
    new 
Float:x,Float:y,Float:z;
    
othercar GetPlayerVehicleID(otherplayer);
    
GetVehiclePos(othercar,x,y,z);
    
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
    
new string[128];
    
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
    
SendClientMessage(playerid,COLOR_RED,string);
    
GetPlayerPos(otherplayer,x,y,z);
    
SetPlayerPos(otherplayer,x,y,z+10);
    return 
true;




Re: I need some help with this command. - GabiXx - 21.12.2015

Thanks for your work.