Witam.
Mam pytanie i problem: Jak wywołać timer określoną liczbę razy np. 5?
A problem jest taki że nie udaje mi się wysłać do funkcji CreateTimer 2 zmiennych. Robię to tak:
public SpawnEnt(client) { decl Float:Location[3]; decl Float:Angles[3]; decl Float:PlayerOrigin[3]; GetClientAbsOrigin(client, PlayerOrigin); GetClientEyeAngles(client, Angles); Location[0] = (PlayerOrigin[0] + (10 * Cosine(DegToRad(Angles[1])))); Location[1] = (PlayerOrigin[1] + (10 * Sine(DegToRad(Angles[1])))); Location[2] = (PlayerOrigin[2] + 20); decl ent; ent = CreateEntityByName("prop_dynamic_override"); DispatchKeyValue(ent, "model", MEDKIT_MODEL); DispatchSpawn(ent); TeleportEntity(ent, Location, NULL_VECTOR, NULL_VECTOR); new Handle:kv = CreateKeyValues("data") KvSetNum(kv, "client", client); KvSetNum(kv, "ent", ent); CreateTimer(1.5, Lecz, kv); CloseHandle(kv); return 0; } public Action:Lecz(Handle:timer, any:data) { new Handle:kv = Handle:data; new client = KvGetNum(kv, "client", -1); //tu jest błąd new ent = KvGetNum(kv, "ent", -1); new Float: locationEnt[3], Float:locationPlayer[3], Float:locationOwner[3]; GetClientAbsOrigin(ent, locationEnt); GetClientAbsOrigin(client, locationOwner); //rozchodzace sie kolo new ringColor[4]={0,255,0,0}; TE_SetupBeamRingPoint(locationEnt,20.0,200.0,g_sprite,0,0,15,1.0,15.0,0.0,ringColor,1,0); TE_SendToAll(); for(new i = 1; i <= MaxClients; i++) { if(!IsClientConnected(i) || i == client || GetClientTeam(client) == GetClientTeam(i)) continue; if(!IsPlayerAlive(i)) continue; GetClientAbsOrigin(i, locationPlayer); if(GetVectorDistance(locationEnt, locationPlayer) <= 200.0) { //code here } } }
I w linijce new client = KvGetNum(kv, "client", -1) wyświetla błąd:
L 02/17/2015 - 22:42:15: [SM] Native "KvGetNum" reported: Invalid key value handle 242017a (error 3) L 02/17/2015 - 22:42:15: [SM] Displaying call stack trace for plugin "0.medyk.smx": L 02/17/2015 - 22:42:15: [SM] [0] Line 97, 0.medyk.sp::Lecz()
Wie ktoś jak to poprawnie przesłać?