18.05.2017, 02:23
Here you are:
NOTE: i just added sscanf.inc include to your script to let it work carefully! so if you haven't it yet download it and include it in your script.
Hope that will work with you!
PHP код:
#include <sscanf>
CMD:drag(playerid, params[])
{
new name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], id;
GetPlayerName(id, name,sizeof(name));
if(IsPlayerConnected(playerid))
{
if(PINFO[playerid][pAdmin] <= 0)
{
SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
return 1;
}
if(sscanf(params,"i",id))
{
SendClientMessage(playerid, COLOR_YELLOW, "Syntax: /drag <PlayerID>");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
if(!newcar) { SCM(playerid,COLOR_ERROR,"You are not in a vehicle."); return 1; }
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
PutPlayerInVehicle(id,newcar,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
new sttr[256];
format(sttr,256,"Admin %s drags you to his/her vehicle.",sendername);
SCM(playa,COLOR_AdminWarn,sttr);
SCM(playerid,COLOR_ERROR,"Dragged.");
}
}
}
return 1;
}
Hope that will work with you!