03.12.2010, 15:46
I'm making spec command but i don't debug the code....
Debug 1 shows what i enter but
Spec[playerid] shows me chars...
code for help..
Debug 1 shows what i enter but
Spec[playerid] shows me chars...
code for help..
pawn Код:
new Spec[MAX_PLAYERS];
new specs[MAX_PLAYERS];
dcmd_spec(playerid,params[])
{
new t;
if(PI[playerid][Admin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not Admin:)!");
if(sscanf(params, "s",t)) return SendClientMessage(playerid, COLOR_GREY, "/spec [id]");
else
{
new t2[128];
format(t2,sizeof(t2),"%s",t);
if(strlen(t2)> 0)
{
if(strcmp("off", t2, true))
{
Spec[playerid] = (-1);
}
else
{
Spec[playerid] = t;
}
}
print(t2); // for debug
print(Spec[playerid]); // for debug
if(Spec[playerid] != (-1))
{
new vehicle2;
vehicle2 = GetPlayerVehicleID(t);
if(vehicle2 == 0)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, t);
specs[playerid] = 1;
}
else
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicle2);
specs[playerid] = 1;
}
}
else
{
TogglePlayerSpectating(playerid, 0);
PlayerSpectatePlayer(playerid, playerid);
specs[playerid] = 0;
}
}
return 1;
}