PDA

View Full Version : I need Drag and stop drag command


Jizz
26/09/2013, 07:50 AM
Can someone help me? Just create it please, I'll match the scripts with my GM.

Voxel
26/09/2013, 11:05 AM
From: http://forum.sa-mp.com/showthread.php?t=280379

hope it works !


CMD:drag(playerid, params[])
{
new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
{ return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You are being dragged by %s,", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
TogglePlayerControllable(giveplayerid, 0);
DragOff[giveplayerid] = playerid;
}
else return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
return 1;
}

Jizz
26/09/2013, 02:48 PM
Not work bro

***Niko***
26/09/2013, 03:56 PM
Not work bro

Maybe you use strcmp...
try this

if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid) && !IsAGovMember(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
return 1;
}
if(PlayerInfo[playerid][pDBanned] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar) || IsAGovernmentCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
new y1, m, d;
new h,mi,s;
getdate(y1,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
CommandLog(string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
}
}
return 1;
}

Command will place player in car on backseat.

Jizz
26/09/2013, 05:50 PM
I'm using ZCMD.

adihanifsdr
24/02/2014, 12:08 PM
It's work, but i need an undrag script ;D can you help me