08.09.2013, 13:19
pawn Код:
if(strcmp(cmd, "/search", true) == 0)
{
if(IsAHitman(playerid))
{
new x_nr[24];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /search [name] [playerid/PartOfName]");
SendClientMessage(playerid, COLOR_GREY, "Available names: house, vehicle, vehicle2, vehicle3");
return 1;
}
if(strcmp(x_nr,"house", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /search house [playerid/PartOfName]");
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallHome", 2000,false,"ii",playerid,giveplayerid);
SetTimerEx("SearchHome",5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
else
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallHome", 2000,false,"ii",playerid,giveplayerid);
SetTimerEx("SearchHome", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
return 1;
}
}
if(strcmp(x_nr,"vehicle", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle [playerid/PartOfName]");
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
else
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
return 1;
}
}
if(strcmp(x_nr,"vehicle2",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle2 [playerid/PartOfName]");
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
else
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle2", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
return 1;
}
}
if(strcmp(x_nr,"vehicle3",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /search vehicle3 [playerid/PartOfName]");
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
else
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s Takes his phone and dials a number.", sendername);
ProxDetector(20.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SetTimerEx("SearchCallVehicle", 2000,false,"i",playerid);
SetTimerEx("SearchVehicle3", 5000,false,"i",playerid);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /search house %s",d,m,y,h,mi,s,sendername, giveplayer);
CommandLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"That Player is offline");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command!");
return 1;
}
return 1;
}
EDIT: my bad, now it should work