pawn Код:
if(strcmp(cmd, "/setvw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setvw [playerid/PartOfName] [virworldid]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
new virid;
tmp = strtok(cmdtext, idx);
virid = strvalEx(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(GetPlayerState(playa) == 2)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
SetPlayerVirtualWorld(playa, virid);
PlayerInfo[playa][pVirWorld] = virid;
new vehicleid = GetPlayerVehicleID(playa);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playa));
format(string, sizeof(string), "** You have set %s's (%d) virtual world to %d.", giveplayer,playa, virid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "~w~Admin %s ~n~~w~Has Set Your Virtual World to ~y~(%d)", sendername, virid);
GameTextForPlayer(playa, string, 4000, 3);
format(string, sizeof(string), "[ADMIN]: %s has set %s's (%d) world to %d.",sendername,giveplayer,playa,virid);
ABroadCast(COLOR_LIGHTRED,string, 5);
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 Has Set %s's World to %d",d,m,y,h,mi,s,sendername,giveplayer,virid);
GiveLog(string);
}
else
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
SetPlayerVirtualWorld(playa, virid);
PlayerInfo[playa][pVirWorld] = virid;
format(string, sizeof(string), " You have set %s's (%d) virtual world to %d.", giveplayer,playa, virid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "~w~Admin %s ~n~~w~Has Set Your Virtual World to ~y~(%d)", sendername, virid);
GameTextForPlayer(playa, string, 4000, 3);
format(string, sizeof(string), "[ADMIN]: %s has set %s's (%d) world to %d.",sendername,giveplayer,playa,virid);
ABroadCast(COLOR_LIGHTRED,string, 5);
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 Has Set %s's World to %d",d,m,y,h,mi,s,sendername,giveplayer,virid);
GiveLog(string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** You are not authorized to use that command!");
}
}
return 1;