No error- just dont work! - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: No error- just dont work! (
/showthread.php?tid=88970)
No error- just dont work! -
Antonio [G-RP] - 30.07.2009
Okay, heres my detain command. I have it all scripted and no errors/warnign appear, but when i do /detain IG, it
doesnt do anything.
Код:
if(strcmp(cmd, "/detain", true) == 0 || strcmp(cmd, "/detain", true) == 0)
{
new suspect;
if(gTeam[playerid] == 2)
{
if(GetDistanceBetweenPlayers(playerid,suspect) < 15)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /detain [playerid] [seat id (1/2/3)]");
new person = strval(tmp);
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /detain [playerid] [seat id (1/2/3)]");
if(gTeam[suspect] == 2)
return SendClientMessage(playerid, COLOR_GRAD2, " You cannot detain cops!");
new seat = strval(tmp);
new Float:pos[6];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerPos(person, pos[3], pos[4], pos[5]);
if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
ClearAnimations(giveplayerid);
PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are too far from the suspect!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a cop!");
}
return 1;
}
Can I get some help please? Thanks. Come check out my server too! 78.159.102.45:6000 Thanks
Re: No error- just dont work! -
Joe Staff - 30.07.2009
In-Game it does absolutely nothing? It looks like it would say
"USAGE: /detain [playerid] [seat id (1/2/3)]");"
Re: No error- just dont work! -
Antonio [G-RP] - 30.07.2009
Well you see when i did example: "/detain 3 2" it would do nothing
Re: No error- just dont work! -
Antonio [G-RP] - 30.07.2009
bump
Re: No error- just dont work! -
Jefff - 30.07.2009
Код:
if(strcmp(cmd, "/detain", true) == 0 || strcmp(cmd, "/detain", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /detain [playerid] [seat id (1/2/3)]");
new person = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /detain [playerid] [seat id (1/2/3)]");
new seat = strval(tmp);
if(IsPlayerConnected(person)) {
if(seat > 0 && seat <= 3) {
if(IsPlayerInAnyVehicle(playerid)) {
if(gTeam[playerid] == 2) {
if(gTeam[person] != 2) {
if(GetDistanceBetweenPlayers(playerid,person) < 15) {
new Float:pos[6];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerPos(person, pos[3], pos[4], pos[5]);
if(floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
ClearAnimations(person);
PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
}else SendClientMessage(playerid, COLOR_GREY, " You are too far from the suspect!");
}else SendClientMessage(playerid, COLOR_GRAD2, " You cannot detain cops!");
}else SendClientMessage(playerid, COLOR_GREY, " You are not a cop!");
}else SendClientMessage(playerid, COLOR_GREY, " You're not in vehicle !");
}else SendClientMessage(playerid, COLOR_GREY, " Seats 0-3 !!");
}else SendClientMessage(playerid, COLOR_GREY, " That ID is not connected !!");
return 1;
}