I need some help with this command.
#1

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.
Reply
#2

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;

Reply
#3

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

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;

Reply
#5

Thanks for your work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)