01.12.2010, 20:53
Im a starter at scripting,i tried to do a /slap and /spec command following some tuts...but something is wrong can someone help me pls?i dont get any errors or warnings.cmds just dont work.
here is slap.
and here is the /spec,/specveh and /specoff.
The problem here is that when i do /spec it show that Beach image...
here is slap.
pawn Код:
if(strcmp(cmd, "/slap", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /slap [playerid/PartOfName]");
return 1;
}
new playa;
new Float:slx, Float:sly, Float:slz;
playa = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new targetlevel = PlayerInfo[playa][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not slap People that is higher Than You!");
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerPos(playa, slx, sly, slz);
PlayerPlaySound(playa, 1190, slx, sly, slz+8);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string, sizeof(string), "[Info:] You slaped %s",GetPlayerNameEx(playa));
SendClientMessage(playerid,COLOR_ADMINCMD,string);
format(string, sizeof(string), "[Info:] You have been slapped by %s",GetPlayerNameEx(playerid));
SendClientMessage(playa,COLOR_WHITE,string);
format(string, sizeof(string), "[Info:] %s have been slapped by %s",GetPlayerNameEx(playa),GetPlayerNameEx(playerid)); //editbs
SendClientMessageToAll(COLOR_ADMINDUTY,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "** you are not authorized to use that command!");
}
}
return 1;
}
The problem here is that when i do /spec it show that Beach image...
pawn Код:
}
if(strcmp(cmd, "/spec", true) == 0 && PlayerInfo[playerid][pAdmin] >= 101) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "USAGE: /spec [playerid]");
return 1;
}
specplayerid = strval(tmp);
if(!IsPlayerConnected(specplayerid)) {
SendClientMessage(playerid, COLOR_RED, " That player isn't active.");
return 1;
}
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, specplayerid);
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
gSpectateID[playerid] = specplayerid;
gSpectateType[playerid] = SPEC_TYPE_PLAYER;
return 1;
}
if(strcmp(cmd, "/specvec", true) == 0 && PlayerInfo[playerid][pAdmin] >= 101) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "USAGE: /specvec [vehicleid]");
return 1;
}
specvehicleid = strval(tmp);
if(specvehicleid < MAX_VEHICLES) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, specvehicleid);
gSpectateID[playerid] = specvehicleid;
gSpectateType[playerid] = SPEC_TYPE_VEHICLE;
}
return 1;
}
if(strcmp(cmd, "/specoff", true) == 0 && PlayerInfo[playerid][pAdmin] >= 101)
{
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = SPEC_TYPE_NONE;
return 1;
}
if (strcmp(cmdtext, "/flip", true) == 0)
{
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdmin] < 103)
{
SendClientMessage(playerid,COLOR_RED,"ADMCENTER: You are not authorized to use that command!");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
new flipid, Float:vehx, Float:vehy, Float:vehz;
GetPlayerPos(playerid, vehx, vehy, vehz);
flipid = GetPlayerVehicleID(playerid);
SetVehiclePos(flipid, vehx, vehy, vehz);
SetVehicleZAngle(flipid, 0);
SendClientMessage(playerid,COLOR_RED,"ADMCENTER: You placed your vehicle on the wheels");
}
else
{
SendClientMessage(playerid,COLOR_RED,"ADMCENTER: You must be in vehicle");
}
return 1;
}