Moin,
ich wollte euch mal fragen, was da an meine system falsch ist:
ocmd:knastzeit(playerid,params[])
{
if(Jailed[playerid]==1)
{
new zeit=GetPVarInt(playerid,"Knastzeit"),string[50];
format(string,50,"Du bist noch %d min im Knast!",zeit);
SendClientMessage(playerid,COLOR_GREEN,string);
}
return 1;
}
ocmd:jail(playerid,params[])
{
new pID;
if(GetPVarInt(playerid,"Fraktion")== 1 || GetPVarInt(playerid,"Fraktion")== 2)
{
if(sscanf(params,"i",pID))return SendClientMessage(playerid,COLOR_GRAD2,"INFO: /jail [ID]");
{
if(GetPlayerWantedLevel(pID)>0)
{
new playerState = GetPlayerState(pID),knastzeit;
if(playerState == PLAYER_STATE_PASSENGER)
{
SetPlayerPos(pID,743.8172,-1351.5823,13.5000);
knastzeit = GetPlayerWantedLevel(pID)*10*60000;
SetPVarInt(pID,"Knastzeit",knastzeit);
//SetTimer("knasttimer",1000,1);
SetTimerEx("knasttimer",1000,1,"d",pID);
Jailed[pID]=1;
}
}
}
}
return 1;
}
forward knasttimer(pID);
public knasttimer(pID)
{
if(GetPVarInt(pID,"Knastzeit")<0)
{
new knastzeit;
knastzeit--;
SetPVarInt(pID,"Knastzeit",knastzeit);
SpielerSpeichern(pID);
}
else
{
OnPlayerSpawn(pID);
SetPVarInt(pID,"Knastzeit",0);
SendClientMessage(pID,COLOR_RED,"Du bist nun nichtmehr im Gefängnis, benimm dich in nächter Zeit!!");
Jailed[pID]=0;
}
return 1;
}
Danke